home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
050a.dms
/
050a.adf
/
EXAMPLE_PROGRAMS
/
example25.AMOS
/
example25.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1992-02-26
|
3KB
|
75 lines
'The beginnings of a ship thingy. It could be anything you want!
'
Rem Hide the mouse pointer and unpack the picture I have stored in bank 10
Rem set double buffer to cut down on flicker.
'-------------------------------------------------------------------------
Hide
Unpack 10 To 0
Double Buffer
'
Rem Set the following variables to be used inside and outside
Rem of procedures.
'-------------------------------------------------------------
Global XOFF,YOFF
Rem Set up the varaiables:
Rem XOFF is the x offset of the screen display
Rem YOFF is Y offset
Rem AC is the x position of the ship
Rem DWN is the y position of the ship, not used in this example.
Rem IMAGE is the bob bank image number being used for the ship,
Rem image 2 is the ship facing right Image 3 facing left
Rem X means horizontal,left<>right, Y means vertical
'--------------------------------------------------------------
XOFF=0 : YOFF=0 : AC=100 : DWN=150 : IMAGE=2
Rem The main loop
'----------------
Do
Rem place the bob 1 at the coordinates ac,dwn (across,down) image will
Rem be set to the correct direction.
'----------------------------------------------------------------------
Bob 1,AC,DWN,IMAGE
Rem now deal with thejoystick. We are only interested in left and right movement.
Rem if pressed to right then we INCrease xoff by one, updated the bobs position
Rem by INCreasing AC then make sure IMAGE is equal to 2 pointing right
If Jright(1) Then Inc XOFF : Inc AC : IMAGE=2
Rem for joystick left is virtually the same except using DECrease and image 3
If Jleft(1) Then Dec XOFF : Dec AC : IMAGE=3
Rem the following lines make sure the ship stays inside the screen
Rem if AC=0 then the ship has reached the left edge of the screen to stop
Rem it going off the edge we make sure AC stays at a minimum of 0.
Remthe right is is 896 we do the same. It's896 because the loaded picture is that wide.
'--------------------------------------------------------------------------------------
If AC<0 Then AC=0
If AC>896 Then AC=896
Rem call the _UPD procedure which scrolls the screen
_UPD
Rem this slows things down and keeps it smooth
Rem try it without to see what you think.
'----------------------------------------------------
Wait Vbl
Rem the end of the main loop, jumps back to the DO command.
Loop
Procedure _UPD
Rem this stops the screen scrolling too far like in the AC bit above
'-------------------------------------------------------------------
If XOFF<0 Then XOFF=0
If XOFF>620 : XOFF=620 : End If
If YOFF<0 Then YOFF=0
If YOFF>200 : YOFF=0 : End If
Rem This is what scrolls the background,
'-----------------------------------------
Screen Offset 0,XOFF,YOFF
End Proc